/*
 * Created on Oct 13, 2005 7:23:09 AM
 * 
 * $Id: ss1_demo_action.java,v 1.2 2005/10/16 14:15:07 olu Exp $
 *
 */
package tripleo.framework.svr.storage;

import java.nio.ByteBuffer;

import tripleo.framework.io.MemoryReadableByteStream;
import tripleo.framework.io.ReadableByteStream;

class ss1_demo_action {
	
	private final class _1 implements FileReader {
		
		ByteBuffer bb = ByteBuffer.allocateDirect(300);
		{
			bb.put("an extreme amount of ridiculous foolishness.".getBytes());
		}

		public long available() {
			return bb.capacity()-bb.position();
		}

		public ReadableByteStream read(int aI) {
			return new MemoryReadableByteStream(bb);
		}
	}

	private void demo_action(IStorageServer demo) throws ss_exception {
		FileReader fr=new _1();
		String cap;
		long startIndex = 17L;
		
		cap=demo.createFile("ignored", fr);
		demo.deleteFile(cap);
		demo.readFile(cap, startIndex);
	}
	
	public static void main(String arg[]) throws ss_exception {
		IStorageServer ss = new ss1("/local/db/ss1.database/");
		(new ss1_demo_action()).demo_action(ss);
	}
}
